package com.demo.module1.controller;

import com.demo.module1.model.User;
import com.demo.module1.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * @author n
 */
@Controller
@RequestMapping("/demo")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/view/index")
    public String viewIndex(){
        return "index";
    }

    @PostMapping("/save")
    public String save(User user){
        userService.save(user);
        return "index";
    }


}
